﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

using LINQSamples.Data;

namespace Web.Samples
{
    public partial class PropertySelect : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.BindQuery();
            this.BindImperative();
        }

        private void BindQuery()
        {
            var query = from o in AddressType.GetAddressTypes()
                        select o.Name;

            foreach (string s in query)
                this.litQueryExpressionResult.Text += s + "<br />\n";

            //var query = from s in query
            //            select s.Substring(0, 1).ToUpper();
        }

        private void BindImperative()
        {
            var list = AddressType.GetAddressTypes().Select(at => at.Name);

            //var list = list.Select(s => s.Substring(0, 1).ToUpper());

            foreach (string s in list)
                this.litImperativeResult.Text += s + "<br />\n";
        }
    }
}
